package ${module};

import ${parents};
import com.ymt.utils.EnvSetup;
import org.json.JSONObject;
/**
*${classdescription}
*FreeMaker Template自动生成代码
*/
public class ${class} extends ${parents}{
	private static String opurl ="${opurl}";
	public ${class}() {
		super(<#if baseurl??>EnvSetup.getSystemUrl("${baseurl}"),</#if>opurl,"${mode}","${format}");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Code
	 * @return
	 */
	public String getCode(){
		String Code = null;
		try{
			Code = new JSONObject(getReturnData()).getString("Code");
		}catch(Exception e){
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取BCode
	 * @return
	 */
	public String getBCode(){
		String BCode = null;
		try{
			BCode = new JSONObject(getReturnData()).getString("BCode");
		}catch(Exception e){
			e.printStackTrace();
		}
		return BCode;
	}
	
	/**
	 * 获取Msg
	 * @return
	 */
	public String getMsg(){
		String BCode = null;
		try{
			BCode = new JSONObject(getReturnData()).getString("Msg");
		}catch(Exception e){
			e.printStackTrace();
		}
		return BCode;
	}
	
	/**
	 * 获取Data
	 * @return
	 */
	public JSONObject getData(){
		JSONObject Data = null;
		try{
			Data = new JSONObject(getReturnData()).getJSONObject("Data");
		}catch(Exception e){
			e.printStackTrace();
		}
		return Data;
	}
}